<html>
<head>
<meta charset="UTF-8">
<title>ftp插件信息配置表新增</title>
<link href="../../static/easyui/themes/bootstrap/easyui.css"
	rel="stylesheet" type="text/css" />
<link href="../../static/easyui/themes/icon.css" rel="stylesheet"
	type="text/css" />
<link href="../../static/css/esaas-easyui-add.css" rel="stylesheet"
	type="text/css" />
<script src="../../static/easyui/jquery.min.js"
	type="text/javascript"></script>
<script src="../../static/easyui/jquery.easyui.min.js"
	type="text/javascript" charset="utf-8"></script>
<script src="../../static/easyui/locale/easyui-lang-zh_CN.js"
	type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.util.js"
	type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.jquery.ajax.js"
	type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.easyui.util.js"
	type="text/javascript"></script>
<script src="../../ffres/dict/all.js" type="text/javascript"></script>
<a href="" target="_blank" id="commonLink" name="commonLink"></a>
<script>
	$(function() {
		$('#pluginConfId').textbox('setValue', $.getUrlParam('pluginConfId'));
	});

	function submitForm() {
		if (!$('#ff').form('validate'))
			return;
		var jsonData = $("#ff").serializeJson();
		$.restfulPostJson('../../api/plugin/ftp/conf', jsonData,
				function(data) {
					window.parent.reloadList();
				});
	};

	function closeForm() {
		window.parent.JLEUtil.closewin();
	};
	/*下拉框选择处理*/
	function doLoadTypeSelect(data) {
		
		if(data.enname == 'upload'){
			//上传处理
			$("#ftpFilePath").textbox("textbox").validatebox('options').required = true;
			
			$("#remoteFileName").textbox("textbox").validatebox('options').required = false;
			$("#remoteFileName").textbox('disable');
			$("#remoteFileName").textbox('setValue', '');
			
			$("#localFilePath").textbox("textbox").validatebox('options').required = true;
			
			$("#localFileName").textbox("textbox").validatebox('options').required = true;
			$("#localFileName").textbox('enable');
			
		}else{
			//下载处理
			$("#ftpFilePath").textbox("textbox").validatebox('options').required = true;
			
			$("#remoteFileName").textbox("textbox").validatebox('options').required = true;
			$("#remoteFileName").textbox('enable');
			
			$("#localFilePath").textbox("textbox").validatebox('options').required = true;
			
			$("#localFileName").textbox("textbox").validatebox('options').required = false;
			$("#localFileName").textbox('disable');
			$("#localFileName").textbox('setValue', '');
		}
	}
</script>
</head>
<body class="easyui-layout">
	<form id="ff" method="post">
		<div class="esaas-info-title">ftp插件信息配置表信息</div>
		<table class="esaas-info-add-table">
			<tr>
				<td width="15%" align="right">配置标识符：</td>
				<td width="35%"><input class="easyui-textbox" type="text"
					id="pluginConfId" name="pluginConfId" data-options="required:true,disabled:true"
					style="width: 100%; height: 25px;"></input></td>
				<td width="15%" align="right">配置顺序：</td>
				<td width="35%"><input class="easyui-textbox" type="text"
					name="confSort" data-options="required:true"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right">连接服务类型：</td>
				<td width="35%"><select class="easyui-combobox" id="serverType"
					name="serverType" style="width: 100%; height: 25px;"
					data-options="required:true,editable:false,valueField:'enname',textField:'cnname',data:FILE_SERVER_TYPE">
				</select></td>
			</tr>
			<tr>
				<td width="15%" align="right">地址：</td>
				<td width="35%"><input class="easyui-textbox" type="text"
					name="sftpServerIp" data-options="required:true"
					style="width: 100%; height: 25px;"></input></td>
				<td width="15%" align="right">端口：</td>
				<td width="35%"><input class="easyui-textbox" type="text"
					name="ftpServerPort" data-options="required:true"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right">用户名：</td>
				<td width="35%"><input class="easyui-textbox" type="text"
					name="ftpServerUser" data-options="required:true"
					style="width: 100%; height: 25px;"></input></td>
				<td width="15%" align="right">密码：</td>
				<td width="35%"><input class="easyui-textbox" type="text"
					name="ftpServerPwd" data-options="required:true"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right">操作类型：</td>
				<td width="35%"><select class="easyui-combobox" id="loadType"
					name="loadType" style="width: 100%; height: 25px;"
					data-options="required:true,editable:false,valueField:'enname',textField:'cnname',data:FILE_OPT_TYPE,onSelect: doLoadTypeSelect">
				</select></td>
			</tr>
			<tr>
				<td width="15%" align="right" id="ftpFilePathLable">服务器文件路径：</td>
				<td colspan="3"><input class="easyui-textbox" type="text"
					id="ftpFilePath" name="ftpFilePath" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right" id="remoteFileNameLable">服务器文件名称：</td>
				<td width="35%"><input class="easyui-textbox" type="text"
					id="remoteFileName" name="remoteFileName" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right" id="localFilePathLable">本地路径：</td>
				<td colspan="3"><input class="easyui-textbox" type="text"
					id="localFilePath" name="localFilePath" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right" id="localFileNameLable">本地文件名称：</td>
				<td width="35%"><input class="easyui-textbox" type="text"
					id="localFileName" name="localFileName" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
		</table>
	</form>
	<div class="esaas-info-buttons">
		<a href="javascript:void(0)" class="easyui-linkbutton " iconCls="icon-ok" onclick="submitForm()" style="width:90px">&nbsp;保&nbsp;存&nbsp;</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="closeForm()" style="width:90px">&nbsp;关&nbsp;闭&nbsp;</a>
	</div>
</body>
</html>